package com.luxondata.module.masterdata.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.luxondata.module.masterdata.entry.Distributor;
import com.luxondata.module.masterdata.service.DistributorService;

@RestController
@RequestMapping("/dist")
public class DistributorController {

	@Autowired
	private DistributorService distService;
	
	/**
	 * 获取所有数据
	 * @return
	 */
	@RequestMapping(value = "/listall", method = RequestMethod.GET)
	public List<Distributor> list() {
		return distService.getAll();
	}
	
	/**
	 * 保存实体
	 * @param dist
	 * @return
	 */
	@RequestMapping(value = "/save", method = RequestMethod.GET)
	public Distributor save(Distributor dist) {
		return distService.save(dist);
	}
	
	/**
	 * 根据id删除实体
	 * @param id
	 */
	@RequestMapping(value = "/delete", method = RequestMethod.GET)
	public void delete(Long id) {
		distService.delete(id);
	}
	

}
